package com.example.juc.big_talk_concurrent.chapter6.article3;

public class Test1 {
    private static ThreadLocal<String> str2 = new ThreadLocal<>();
    private static ThreadLocal<String> str3 = new ThreadLocal<>();

    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(){
            @Override
            public void run(){
                super.run();
                str2.set("child1");
                str3.set("child1");

                System.out.println(str2.get());
                System.out.println(str3.get());
            }
        };

        Thread t2 = new Thread(){
            @Override
            public void run(){
                super.run();
                str2.set("child2");
                str3.set("child2");

                System.out.println(str2.get());
                System.out.println(str3.get());
            }
        };

        t1.start();
        t1.join();

        t2.start();
        t2.join();

    }
}
